package cn.eaay.stock.controller;

import cn.eaay.stock.service.UserService;
import cn.eaay.stock.vo.req.LoginReqVo;
import cn.eaay.stock.vo.resp.LoginRespVo;
import cn.eaay.stock.vo.resp.R;
import io.swagger.annotations.*;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "用户管理")
@RestController
@RequestMapping("/api")
public class UserController {

    @Resource
    private UserService userService;

    /**
     * 用户登录
     *
     * @param vo 登录请求对象
     * @return {@link R<LoginRespVo}
     */
    @ApiOperation(value = "用户登录", notes = "用户登录 api")
    @PostMapping("/login")
    public R login(@RequestBody LoginReqVo vo) {
        R<LoginRespVo> result = userService.login(vo);
        return result;
    }
}
